package org.personal.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;

public class ConnectionManager {
	
	private Properties jdbcData=null;
	
	public ConnectionManager(Properties prop){
		this.jdbcData=prop;
	}
	
	public Connection getConnection() {
		String driver = jdbcData.getProperty("driver"),
		url = jdbcData.getProperty("url"),
		user = jdbcData.getProperty("username"),
		password = jdbcData.getProperty("password");
		try {
			Class.forName(driver).getInterfaces();
			return DriverManager.getConnection(url, user, password);
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
